package com.nforce.linremote.model;

import android.os.Bundle;

public class Server {

    private String address;
    private String hostname;
    private int port;

    public Server() {
    }

    public Server(Bundle bundle) {
	address = bundle.getString("address");
	hostname = bundle.getString("hostname");
	port = bundle.getInt("port");
    }

    public String getAddress() {
	return address;
    }

    public void setAddress(String address) {
	this.address = address;
    }

    public String getHostname() {
	return hostname;
    }

    public void setHostname(String hostname) {
	this.hostname = hostname;
    }

    public int getPort() {
	return port;
    }

    public void setPort(int port) {
	this.port = port;
    }

    public Bundle toBundle() {
	Bundle result = new Bundle();
	result.putString("hostname", hostname);
	result.putString("address", address);
	result.putInt("port", port);
	return result;
    }

    @Override
    public boolean equals(Object obj) {
	if (this == obj) {
	    return true;
	}
	if (obj == null) {
	    return false;
	}
	if (getClass() != obj.getClass()) {
	    return false;
	}
	Server other = (Server) obj;
	if (address == null) {
	    if (other.address != null) {
		return false;
	    }
	} else if (!address.equals(other.address)) {
	    return false;
	}
	if (port != other.port) {
	    return false;
	}
	return true;
    }

    @Override
    public String toString() {
	return "Server [address=" + address + ", hostname=" + hostname
		+ ", port=" + port + "]";
    }

}
